#include <iostream>
#include <string>
#include <algorithm>
#include <cppunit/config/SourcePrefix.h>
#include "TestPKBNextBip.h"

void PKBNextBipTest::setUp(){
	PKB::initializeInstance();
	pkb = PKB::getInstance();
	pkb->clear();
	samples.clear();
	samplep.clear();
}

void PKBNextBipTest::tearDown(){
}
//Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION(PKBNextBipTest);
/**********************
** single call only case
** 1. last statement of proc1 is while
** 2. last statement of proc2 is call
***********************/
/*
Procedure proc1{
(1)		w = 5;
(2)		while x {
(3)			if x then{
(4)				call proc2;
			}else{
(5)				if y then{
(6)					call proc3;
				}else{
(7)					x = 0;
				}
			}
		}
}

Procedure proc2{
(8)		w = z + 2;
(9)		call proc3;
}

Procedure proc3{
(10)	call proc4;
(11)	y = y + z + x - w;
}

Procedure proc4{
(12)	y = y + z + x - w;
}
*/

void PKBNextBipTest::insertProc(){
	pkb = PKB::getInstance();
	
	CPPUNIT_ASSERT_EQUAL(1,pkb->insertProc("proc1"));
	CPPUNIT_ASSERT_EQUAL(2,pkb->insertProc("proc2"));
	CPPUNIT_ASSERT_EQUAL(3,pkb->insertProc("proc3"));
	CPPUNIT_ASSERT_EQUAL(4,pkb->insertProc("proc4"));
	pkb->insertProcStartEnd(1,1,7);
	pkb->insertProcStartEnd(2,8,9);
	pkb->insertProcStartEnd(3,10,11);
	pkb->insertProcStartEnd(4,12,12);
	pkb->setProcExitPoint(1,2);
	pkb->setProcExitPoint(2,9);
	pkb->setProcExitPoint(3,11);
	pkb->setProcExitPoint(4,12);
}
void PKBNextBipTest::insertLineEntity(){
	pkb = PKB::getInstance();

	// procedure 1
	CPPUNIT_ASSERT(pkb->insertLineEntity(1, Type::Entity::ASSIGNMENT_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(2, Type::Entity::WHILE_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(3, Type::Entity::IF_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(4, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(5, Type::Entity::IF_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(6, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(7, Type::Entity::ASSIGNMENT_LINE_ENTITY));
	// procedure 2
	CPPUNIT_ASSERT(pkb->insertLineEntity(8, Type::Entity::ASSIGNMENT_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(9, Type::Entity::CALL_LINE_ENTITY));
	// procedure 3
	CPPUNIT_ASSERT(pkb->insertLineEntity(10, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(11, Type::Entity::ASSIGNMENT_LINE_ENTITY));
	// procedure 4
	CPPUNIT_ASSERT(pkb->insertLineEntity(12, Type::Entity::ASSIGNMENT_LINE_ENTITY));
}
void PKBNextBipTest::setNext(){
	pkb = PKB::getInstance();
	// prcodedure 1
	pkb->setNext(1,2);
	pkb->setNext(2,3);
	pkb->setNext(3,4);
	pkb->setNext(3,5);
	pkb->setNext(5,6);
	pkb->setNext(5,7);
	pkb->setNext(4,2);
	pkb->setNext(6,2);
	pkb->setNext(7,2);
	// procedure 2
	pkb->setNext(8,9);
	// procedure 3
	pkb->setNext(10,11);
	// procedure 4
	// none
}
void PKBNextBipTest::setCall(){
	pkb = PKB::getInstance();
	pkb->setCalls(1,4,2);
	pkb->setCalls(1,6,3);
	pkb->setCalls(2,9,3);
	pkb->setCalls(3,10,4);
}
void PKBNextBipTest::setParent(){
	pkb = PKB::getInstance();
	pkb->setParent(2,3);
	pkb->setParent(3,4);
	pkb->setParent(3,5);
	pkb->setParent(5,6);
	pkb->setParent(5,7);
}
void PKBNextBipTest::setFollow(){
	pkb = PKB::getInstance();
	pkb->setFollows(1,2);
	pkb->setFollows(8,9);
	pkb->setFollows(10,11);
}
void PKBNextBipTest::setNextBip(){
	pkb = PKB::getInstance();
	//branch in 
	pkb->setNextBip(4,8);
	pkb->setNextBip(6,10);
	pkb->setNextBip(9,10);
	pkb->setNextBip(10,12);
	//branch back
	pkb->setNextBip(12,11);
	pkb->setNextBip(11,2);
}
void PKBNextBipTest::setSamplePredecessor(){
	//total line is 12

	Type::List::Line line1Pred;
	samplep.push_back(line1Pred);
	
	Type::Index::Line temp2[] = {1,7,11};
	Type::List::Line line2Pred (temp2,temp2+sizeof(temp2)/sizeof(Type::Index::Line));
	samplep.push_back(line2Pred);

	Type::Index::Line temp3[] = {2};
	Type::List::Line line3Pred (temp3,temp3+sizeof(temp3)/sizeof(Type::Index::Line));
	samplep.push_back(line3Pred);

	Type::Index::Line temp4[] = {3};
	Type::List::Line line4Pred (temp4,temp4+sizeof(temp4)/sizeof(Type::Index::Line));
	samplep.push_back(line4Pred);

	Type::Index::Line temp5[] = {3};
	Type::List::Line line5Pred (temp5,temp5+sizeof(temp5)/sizeof(Type::Index::Line));
	samplep.push_back(line5Pred);

	Type::Index::Line temp6[] = {5};
	Type::List::Line line6Pred (temp6,temp6+sizeof(temp6)/sizeof(Type::Index::Line));
	samplep.push_back(line6Pred);
	
	Type::Index::Line temp7[] = {5};
	Type::List::Line line7Pred (temp7,temp7+sizeof(temp7)/sizeof(Type::Index::Line));
	samplep.push_back(line7Pred);
	
	Type::Index::Line temp8[] = {4};
	Type::List::Line line8Pred (temp8,temp8+sizeof(temp8)/sizeof(Type::Index::Line));
	samplep.push_back(line8Pred);
	
	Type::Index::Line temp9[] = {8};
	Type::List::Line line9Pred (temp9,temp9+sizeof(temp9)/sizeof(Type::Index::Line));
	samplep.push_back(line9Pred);
	
	Type::Index::Line temp10[] = {6,9};
	Type::List::Line line10Pred (temp10,temp10+sizeof(temp10)/sizeof(Type::Index::Line));
	samplep.push_back(line10Pred);

	Type::Index::Line temp11[] = {12};
	Type::List::Line line11Pred (temp11,temp11+sizeof(temp11)/sizeof(Type::Index::Line));
	samplep.push_back(line11Pred);

	Type::Index::Line temp12[] = {10};
	Type::List::Line line12Pred (temp12,temp12+sizeof(temp12)/sizeof(Type::Index::Line));
	samplep.push_back(line12Pred);
}
void PKBNextBipTest::setSampleSuccessor(){
	//total line is 12

	Type::Index::Line temp1[] = {2};
	Type::List::Line line1Suc (temp1,temp1+sizeof(temp1)/sizeof(Type::Index::Line));
	samples.push_back(line1Suc);
	
	Type::Index::Line temp2[] = {3};
	Type::List::Line line2Suc (temp2,temp2+sizeof(temp2)/sizeof(Type::Index::Line));
	samples.push_back(line2Suc);

	Type::Index::Line temp3[] = {4,5};
	Type::List::Line line3Suc (temp3,temp3+sizeof(temp3)/sizeof(Type::Index::Line));
	samples.push_back(line3Suc);

	Type::Index::Line temp4[] = {8};
	Type::List::Line line4Suc (temp4,temp4+sizeof(temp4)/sizeof(Type::Index::Line));
	samples.push_back(line4Suc);

	Type::Index::Line temp5[] = {6,7};
	Type::List::Line line5Suc (temp5,temp5+sizeof(temp5)/sizeof(Type::Index::Line));
	samples.push_back(line5Suc);

	Type::Index::Line temp6[] = {10};
	Type::List::Line line6Suc (temp6,temp6+sizeof(temp6)/sizeof(Type::Index::Line));
	samples.push_back(line6Suc);
	
	Type::Index::Line temp7[] = {2};
	Type::List::Line line7Suc (temp7,temp7+sizeof(temp7)/sizeof(Type::Index::Line));
	samples.push_back(line7Suc);
	
	Type::Index::Line temp8[] = {9};
	Type::List::Line line8Suc (temp8,temp8+sizeof(temp8)/sizeof(Type::Index::Line));
	samples.push_back(line8Suc);
	
	Type::Index::Line temp9[] = {10};
	Type::List::Line line9Suc (temp9,temp9+sizeof(temp9)/sizeof(Type::Index::Line));
	samples.push_back(line9Suc);
	
	Type::Index::Line temp10[] = {12};
	Type::List::Line line10Suc (temp10,temp10+sizeof(temp10)/sizeof(Type::Index::Line));
	samples.push_back(line10Suc);

	Type::Index::Line temp11[] = {2};
	Type::List::Line line11Suc (temp11,temp11+sizeof(temp11)/sizeof(Type::Index::Line));
	samples.push_back(line11Suc);

	Type::Index::Line temp12[] = {11};
	Type::List::Line line12Suc (temp12,temp12+sizeof(temp12)/sizeof(Type::Index::Line));
	samples.push_back(line12Suc);
}
void PKBNextBipTest::setSampleSuccessorStar(){
	//total line is 12
	Type::Index::Line temp1[] = {2,3,4,5,6,7,8,9,10,11,12};
	Type::List::Line line1Suc (temp1,temp1+sizeof(temp1)/sizeof(Type::Index::Line));
	samplesStar.push_back(line1Suc);
	
	Type::Index::Line temp2[] = {3,4,5,6,7,8,9,10,11,12,2};
	Type::List::Line line2Suc (temp2,temp2+sizeof(temp2)/sizeof(Type::Index::Line));
	samplesStar.push_back(line2Suc);

	Type::Index::Line temp3[] = {4,5,6,7,8,9,10,11,12,2,3};
	Type::List::Line line3Suc (temp3,temp3+sizeof(temp3)/sizeof(Type::Index::Line));
	samplesStar.push_back(line3Suc);

	Type::Index::Line temp4[] = {8,9,10,11,12,2,3,4,5,6,7};
	Type::List::Line line4Suc (temp4,temp4+sizeof(temp4)/sizeof(Type::Index::Line));
	samplesStar.push_back(line4Suc);

	Type::Index::Line temp5[] = {8,9,10,11,12,2,3,4,5,6,7};
	Type::List::Line line5Suc (temp5,temp5+sizeof(temp5)/sizeof(Type::Index::Line));
	samplesStar.push_back(line5Suc);

	Type::Index::Line temp6[] = {8,9,10,11,12,2,3,4,5,6,7};
	Type::List::Line line6Suc (temp6,temp6+sizeof(temp6)/sizeof(Type::Index::Line));
	samplesStar.push_back(line6Suc);
	
	Type::Index::Line temp7[] = {8,9,10,11,12,2,3,4,5,6,7};
	Type::List::Line line7Suc (temp7,temp7+sizeof(temp7)/sizeof(Type::Index::Line));
	samplesStar.push_back(line7Suc);
	
	Type::Index::Line temp8[] = {2,3,4,5,6,7,8,9,10,11,12};
	Type::List::Line line8Suc (temp8,temp8+sizeof(temp8)/sizeof(Type::Index::Line));
	samplesStar.push_back(line8Suc);
	
	Type::Index::Line temp9[] = {2,3,4,5,6,7,8,9,10,11,12};
	Type::List::Line line9Suc (temp9,temp9+sizeof(temp9)/sizeof(Type::Index::Line));
	samplesStar.push_back(line9Suc);
	
	Type::Index::Line temp10[] = {2,3,4,5,6,7,8,9,10,11,12};
	Type::List::Line line10Suc (temp10,temp10+sizeof(temp10)/sizeof(Type::Index::Line));
	samplesStar.push_back(line10Suc);

	Type::Index::Line temp11[] = {2,3,4,5,6,7,8,9,10,11,12};
	Type::List::Line line11Suc (temp11,temp11+sizeof(temp11)/sizeof(Type::Index::Line));
	samplesStar.push_back(line11Suc);

	Type::Index::Line temp12[] = {2,3,4,5,6,7,8,9,10,11,12};
	Type::List::Line line12Suc (temp12,temp12+sizeof(temp12)/sizeof(Type::Index::Line));
	samplesStar.push_back(line12Suc);
}
void PKBNextBipTest::setSamplePredecessorStar(){
	//samplepStarStar
	//total line is 12

	Type::List::Line line1Pred;
	samplepStar.push_back(line1Pred);
	
	Type::Index::Line temp2[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line2Pred (temp2,temp2+sizeof(temp2)/sizeof(Type::Index::Line));
	samplepStar.push_back(line2Pred);

	Type::Index::Line temp3[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line3Pred (temp3,temp3+sizeof(temp3)/sizeof(Type::Index::Line));
	samplepStar.push_back(line3Pred);

	Type::Index::Line temp4[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line4Pred (temp4,temp4+sizeof(temp4)/sizeof(Type::Index::Line));
	samplepStar.push_back(line4Pred);

	Type::Index::Line temp5[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line5Pred (temp5,temp5+sizeof(temp5)/sizeof(Type::Index::Line));
	samplepStar.push_back(line5Pred);

	Type::Index::Line temp6[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line6Pred (temp6,temp6+sizeof(temp6)/sizeof(Type::Index::Line));
	samplepStar.push_back(line6Pred);
	
	Type::Index::Line temp7[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line7Pred (temp7,temp7+sizeof(temp7)/sizeof(Type::Index::Line));
	samplepStar.push_back(line7Pred);
	
	Type::Index::Line temp8[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line8Pred (temp8,temp8+sizeof(temp8)/sizeof(Type::Index::Line));
	samplepStar.push_back(line8Pred);
	
	Type::Index::Line temp9[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line9Pred (temp9,temp9+sizeof(temp9)/sizeof(Type::Index::Line));
	samplepStar.push_back(line9Pred);
	
	Type::Index::Line temp10[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line10Pred (temp10,temp10+sizeof(temp10)/sizeof(Type::Index::Line));
	samplepStar.push_back(line10Pred);

	Type::Index::Line temp11[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line11Pred (temp11,temp11+sizeof(temp11)/sizeof(Type::Index::Line));
	samplepStar.push_back(line11Pred);

	Type::Index::Line temp12[] = {1,7,11,5,3,2,12,10,9,8,4,6};
	Type::List::Line line12Pred (temp12,temp12+sizeof(temp12)/sizeof(Type::Index::Line));
	samplepStar.push_back(line12Pred);
}

/**********************
** Multiple calls case (19)
** 1. last statement of proc1 is while or call
** 2. last and first statement of proc2 is while
** 3. last and first of proc3 is call; last might be assignment
** 4. one line
***********************/
/*
Procedure proc1{
(1)	x = 0;
(2)	call proc2;
(3)	call proc2;
(4)	call proc4;
(5)	if x then{
(6)		while x{
(7)			call proc3;
		}
	}else{
(8)		call proc2;
	}
}

Procedure proc2{
(9)	while x{
(10)		call proc3;
(11)		if x then{
(12)			x = 0;
    		}else{
(13)			call proc3;
		}
	}
}

Procedure proc3{
(14)	call proc4;
(15)	if x then{
(16)		call proc4;
(17)		call proc4;
    	}else{
(18)		z = 0;
	}
}

Procedure proc4{
(19)	y = y + z + x - w;
}
*/

void PKBNextBipTest::insertProcMultiCall(){
	pkb = PKB::getInstance();
	
	CPPUNIT_ASSERT_EQUAL(1,pkb->insertProc("proc1"));
	CPPUNIT_ASSERT_EQUAL(2,pkb->insertProc("proc2"));
	CPPUNIT_ASSERT_EQUAL(3,pkb->insertProc("proc3"));
	CPPUNIT_ASSERT_EQUAL(4,pkb->insertProc("proc4"));
	pkb->insertProcStartEnd(1,1,8);
	pkb->insertProcStartEnd(2,9,13);
	pkb->insertProcStartEnd(3,14,18);
	pkb->insertProcStartEnd(4,19,19);
	pkb->setProcExitPoint(1,6);
	pkb->setProcExitPoint(1,8);
	pkb->setProcExitPoint(2,9);
	pkb->setProcExitPoint(3,17);
	pkb->setProcExitPoint(3,18);
	pkb->setProcExitPoint(4,19);
}
void PKBNextBipTest::insertLineEntityMultiCall(){
	pkb = PKB::getInstance();

	// procedure 1
	CPPUNIT_ASSERT(pkb->insertLineEntity(1, Type::Entity::ASSIGNMENT_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(2, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(3, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(4, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(5, Type::Entity::IF_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(6, Type::Entity::WHILE_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(7, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(8, Type::Entity::CALL_LINE_ENTITY));
	// procedure 2
	CPPUNIT_ASSERT(pkb->insertLineEntity(9, Type::Entity::WHILE_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(10, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(11, Type::Entity::IF_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(12, Type::Entity::ASSIGNMENT_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(13, Type::Entity::CALL_LINE_ENTITY));
	// procedure 3
	CPPUNIT_ASSERT(pkb->insertLineEntity(14, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(15, Type::Entity::IF_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(16, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(17, Type::Entity::CALL_LINE_ENTITY));
	CPPUNIT_ASSERT(pkb->insertLineEntity(18, Type::Entity::ASSIGNMENT_LINE_ENTITY));
	// procedure 4
	CPPUNIT_ASSERT(pkb->insertLineEntity(19, Type::Entity::ASSIGNMENT_LINE_ENTITY));
}
void PKBNextBipTest::setNextMultiCall(){
	pkb = PKB::getInstance();
	// prcodedure 1
	pkb->setNext(1,2);
	pkb->setNext(2,3);
	pkb->setNext(3,4);
	pkb->setNext(4,5);
	pkb->setNext(5,6);
	pkb->setNext(5,8);
	pkb->setNext(6,7);
	pkb->setNext(7,6);
	// procedure 2
	pkb->setNext(9,10);
	pkb->setNext(10,11);
	pkb->setNext(11,12);
	pkb->setNext(11,13);
	pkb->setNext(13,9);
	pkb->setNext(12,9);

	// procedure 3
	pkb->setNext(14,15);
	pkb->setNext(15,16);
	pkb->setNext(15,18);
	pkb->setNext(16,17);
	// procedure 4
	// none
}
void PKBNextBipTest::setCallMultiCall(){
	pkb = PKB::getInstance();
	// proc1
	pkb->setCalls(1,2,2);
	pkb->setCalls(1,3,2);
	pkb->setCalls(1,4,4);
	pkb->setCalls(1,7,3);
	pkb->setCalls(1,8,2);
	// proc2
	pkb->setCalls(2,10,3);
	pkb->setCalls(2,13,3);
	// proc3
	pkb->setCalls(3,14,4);
	pkb->setCalls(3,16,4);
	pkb->setCalls(3,17,4);
}
void PKBNextBipTest::setParentMultiCall(){
	pkb = PKB::getInstance();
	pkb->setParent(5,6);
	pkb->setParent(5,8);
	pkb->setParent(6,7);
	pkb->setParent(9,10);
	pkb->setParent(9,11);
	pkb->setParent(11,12);
	pkb->setParent(11,13);
	pkb->setParent(15,16);
	pkb->setParent(15,17);
	pkb->setParent(15,18);
}
void PKBNextBipTest::setFollowMultiCall(){
	pkb = PKB::getInstance();
	pkb->setFollows(1,2);
	pkb->setFollows(2,3);
	pkb->setFollows(3,4);
	pkb->setFollows(4,5);
	pkb->setFollows(14,15);
	pkb->setFollows(10,11);
	pkb->setFollows(16,17);
}
void PKBNextBipTest::setNextBipMultiCall(){
	pkb = PKB::getInstance();
	//branch in 
	pkb->setNextBip(2,9);
	pkb->setNextBip(3,9);
	pkb->setNextBip(4,19);
	pkb->setNextBip(8,9);
	pkb->setNextBip(7,14);

	pkb->setNextBip(10,14);
	pkb->setNextBip(13,14);
	pkb->setNextBip(14,19);
	pkb->setNextBip(16,19);
	pkb->setNextBip(17,19);
	//branch back
	//proc1
	pkb->setNextBip(9,3);
	pkb->setNextBip(9,4);
	pkb->setNextBip(19,5);
	pkb->setNextBip(19,6);
	pkb->setNextBip(18,6);
	//proc2
	pkb->setNextBip(19,11);
	pkb->setNextBip(18,11);
	pkb->setNextBip(19,9);
	pkb->setNextBip(18,9);
	//proc3
	pkb->setNextBip(19,15);
	pkb->setNextBip(19,17);
}
void PKBNextBipTest::setSampleSuccessorMultiCall(){
	//total line is 19

	Type::Index::Line temp1[] = {2};
	Type::List::Line line1Suc (temp1,temp1+sizeof(temp1)/sizeof(Type::Index::Line));
	samples.push_back(line1Suc);
	
	Type::Index::Line temp2[] = {9};
	Type::List::Line line2Suc (temp2,temp2+sizeof(temp2)/sizeof(Type::Index::Line));
	samples.push_back(line2Suc);

	Type::Index::Line temp3[] = {9};
	Type::List::Line line3Suc (temp3,temp3+sizeof(temp3)/sizeof(Type::Index::Line));
	samples.push_back(line3Suc);

	Type::Index::Line temp4[] = {19};
	Type::List::Line line4Suc (temp4,temp4+sizeof(temp4)/sizeof(Type::Index::Line));
	samples.push_back(line4Suc);

	Type::Index::Line temp5[] = {6,8};
	Type::List::Line line5Suc (temp5,temp5+sizeof(temp5)/sizeof(Type::Index::Line));
	samples.push_back(line5Suc);

	Type::Index::Line temp6[] = {7};
	Type::List::Line line6Suc (temp6,temp6+sizeof(temp6)/sizeof(Type::Index::Line));
	samples.push_back(line6Suc);
	
	Type::Index::Line temp7[] = {14};
	Type::List::Line line7Suc (temp7,temp7+sizeof(temp7)/sizeof(Type::Index::Line));
	samples.push_back(line7Suc);
	
	Type::Index::Line temp8[] = {9};
	Type::List::Line line8Suc (temp8,temp8+sizeof(temp8)/sizeof(Type::Index::Line));
	samples.push_back(line8Suc);
	
	Type::Index::Line temp9[] = {3, 4, 10};
	Type::List::Line line9Suc (temp9,temp9+sizeof(temp9)/sizeof(Type::Index::Line));
	samples.push_back(line9Suc);
	
	Type::Index::Line temp10[] = {14};
	Type::List::Line line10Suc (temp10,temp10+sizeof(temp10)/sizeof(Type::Index::Line));
	samples.push_back(line10Suc);

	Type::Index::Line temp11[] = {12,13};
	Type::List::Line line11Suc (temp11,temp11+sizeof(temp11)/sizeof(Type::Index::Line));
	samples.push_back(line11Suc);

	Type::Index::Line temp12[] = {9};
	Type::List::Line line12Suc (temp12,temp12+sizeof(temp12)/sizeof(Type::Index::Line));
	samples.push_back(line12Suc);

	Type::Index::Line temp13[] = {14};
	Type::List::Line line13Suc (temp13,temp13+sizeof(temp13)/sizeof(Type::Index::Line));
	samples.push_back(line13Suc);

	Type::Index::Line temp14[] = {19};
	Type::List::Line line14Suc (temp14,temp14+sizeof(temp14)/sizeof(Type::Index::Line));
	samples.push_back(line14Suc);

	Type::Index::Line temp15[] = {16,18};
	Type::List::Line line15Suc (temp15,temp15+sizeof(temp15)/sizeof(Type::Index::Line));
	samples.push_back(line15Suc);

	Type::Index::Line temp16[] = {19};
	Type::List::Line line16Suc (temp16,temp16+sizeof(temp16)/sizeof(Type::Index::Line));
	samples.push_back(line16Suc);

	Type::Index::Line temp17[] = {19};
	Type::List::Line line17Suc (temp17,temp17+sizeof(temp17)/sizeof(Type::Index::Line));
	samples.push_back(line17Suc);

	Type::Index::Line temp18[] = {6,9,11};
	Type::List::Line line18Suc (temp18,temp18+sizeof(temp18)/sizeof(Type::Index::Line));
	samples.push_back(line18Suc);

	Type::Index::Line temp19[] = {5,6,9,11,15,17};
	Type::List::Line line19Suc (temp19,temp19+sizeof(temp19)/sizeof(Type::Index::Line));
	samples.push_back(line19Suc);
}
void PKBNextBipTest::setSamplePredecessorMultiCall(){
	//total line is 19

	Type::List::Line line1Pred;
	samplep.push_back(line1Pred);
	
	Type::Index::Line temp2[] = {1};
	Type::List::Line line2Pred (temp2,temp2+sizeof(temp2)/sizeof(Type::Index::Line));
	samplep.push_back(line2Pred);

	Type::Index::Line temp3[] = {9};
	Type::List::Line line3Pred (temp3,temp3+sizeof(temp3)/sizeof(Type::Index::Line));
	samplep.push_back(line3Pred);

	Type::Index::Line temp4[] = {9};
	Type::List::Line line4Pred (temp4,temp4+sizeof(temp4)/sizeof(Type::Index::Line));
	samplep.push_back(line4Pred);

	Type::Index::Line temp5[] = {19};
	Type::List::Line line5Pred (temp5,temp5+sizeof(temp5)/sizeof(Type::Index::Line));
	samplep.push_back(line5Pred);

	Type::Index::Line temp6[] = {5,18,19};
	Type::List::Line line6Pred (temp6,temp6+sizeof(temp6)/sizeof(Type::Index::Line));
	samplep.push_back(line6Pred);
	
	Type::Index::Line temp7[] = {6};
	Type::List::Line line7Pred (temp7,temp7+sizeof(temp7)/sizeof(Type::Index::Line));
	samplep.push_back(line7Pred);
	
	Type::Index::Line temp8[] = {5};
	Type::List::Line line8Pred (temp8,temp8+sizeof(temp8)/sizeof(Type::Index::Line));
	samplep.push_back(line8Pred);
	
	Type::Index::Line temp9[] = {2,3,8,12,18,19};
	Type::List::Line line9Pred (temp9,temp9+sizeof(temp9)/sizeof(Type::Index::Line));
	samplep.push_back(line9Pred);
	
	Type::Index::Line temp10[] = {9};
	Type::List::Line line10Pred (temp10,temp10+sizeof(temp10)/sizeof(Type::Index::Line));
	samplep.push_back(line10Pred);

	Type::Index::Line temp11[] = {18,19};
	Type::List::Line line11Pred (temp11,temp11+sizeof(temp11)/sizeof(Type::Index::Line));
	samplep.push_back(line11Pred);

	Type::Index::Line temp12[] = {11};
	Type::List::Line line12Pred (temp12,temp12+sizeof(temp12)/sizeof(Type::Index::Line));
	samplep.push_back(line12Pred);

	Type::Index::Line temp13[] = {11};
	Type::List::Line line13Pred (temp13,temp13+sizeof(temp13)/sizeof(Type::Index::Line));
	samplep.push_back(line13Pred);

	Type::Index::Line temp14[] = {7,10,13};
	Type::List::Line line14Pred (temp14,temp14+sizeof(temp14)/sizeof(Type::Index::Line));
	samplep.push_back(line14Pred);

	Type::Index::Line temp15[] = {19};
	Type::List::Line line15Pred (temp15,temp15+sizeof(temp15)/sizeof(Type::Index::Line));
	samplep.push_back(line15Pred);

	Type::Index::Line temp16[] = {15};
	Type::List::Line line16Pred (temp16,temp16+sizeof(temp16)/sizeof(Type::Index::Line));
	samplep.push_back(line16Pred);

	Type::Index::Line temp17[] = {19};
	Type::List::Line line17Pred (temp17,temp17+sizeof(temp17)/sizeof(Type::Index::Line));
	samplep.push_back(line17Pred);

	Type::Index::Line temp18[] = {15};
	Type::List::Line line18Pred (temp18,temp18+sizeof(temp18)/sizeof(Type::Index::Line));
	samplep.push_back(line18Pred);

	Type::Index::Line temp19[] = {4,14,16,17};
	Type::List::Line line19Pred (temp19,temp19+sizeof(temp19)/sizeof(Type::Index::Line));
	samplep.push_back(line19Pred);
}
void PKBNextBipTest::setSampleSuccessorStarMultiCall(){
	//total line is 19

	Type::Index::Line temp1[] = {2,9,10,14,19,15,16,17,18,11,12,13,3,4,5,6,7,8};
	Type::List::Line line1Suc (temp1,temp1+sizeof(temp1)/sizeof(Type::Index::Line));
	samplesStar.push_back(line1Suc);
	
	Type::Index::Line temp2[] = {9,10,14,19,15,16,17,18,11,12,13,3,4,5,6,7,8};
	Type::List::Line line2Suc (temp2,temp2+sizeof(temp2)/sizeof(Type::Index::Line));
	samplesStar.push_back(line2Suc);

	Type::Index::Line temp3[] = {9,10,14,19,15,16,17,18,11,12,13,4,5,6,7,8};
	Type::List::Line line3Suc (temp3,temp3+sizeof(temp3)/sizeof(Type::Index::Line));
	samplesStar.push_back(line3Suc);

	Type::Index::Line temp4[] = {9,10,14,19,15,16,17,18,11,12,13,5,6,7,8};
	Type::List::Line line4Suc (temp4,temp4+sizeof(temp4)/sizeof(Type::Index::Line));
	samplesStar.push_back(line4Suc);

	Type::Index::Line temp5[] = {9,10,14,19,15,16,17,18,11,12,13,6,7,8};
	Type::List::Line line5Suc (temp5,temp5+sizeof(temp5)/sizeof(Type::Index::Line));
	samplesStar.push_back(line5Suc);

	Type::Index::Line temp6[] = {7,14,19,15,16,17,6,18};
	Type::List::Line line6Suc (temp6,temp6+sizeof(temp6)/sizeof(Type::Index::Line));
	samplesStar.push_back(line6Suc);
	
	Type::Index::Line temp7[] = {14,19,15,16,17,6,7,18};
	Type::List::Line line7Suc (temp7,temp7+sizeof(temp7)/sizeof(Type::Index::Line));
	samplesStar.push_back(line7Suc);
	
	Type::Index::Line temp8[] = {9,10,11,12,13,14,15,16,17,18,19};
	Type::List::Line line8Suc (temp8,temp8+sizeof(temp8)/sizeof(Type::Index::Line));
	samplesStar.push_back(line8Suc);
	
	Type::Index::Line temp9[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line9Suc (temp9,temp9+sizeof(temp9)/sizeof(Type::Index::Line));
	samplesStar.push_back(line9Suc);
	
	Type::Index::Line temp10[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line10Suc (temp10,temp10+sizeof(temp10)/sizeof(Type::Index::Line));
	samplesStar.push_back(line10Suc);

	Type::Index::Line temp11[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line11Suc (temp11,temp11+sizeof(temp11)/sizeof(Type::Index::Line));
	samplesStar.push_back(line11Suc);

	Type::Index::Line temp12[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line12Suc (temp12,temp12+sizeof(temp12)/sizeof(Type::Index::Line));
	samplesStar.push_back(line12Suc);

	Type::Index::Line temp13[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line13Suc (temp13,temp13+sizeof(temp13)/sizeof(Type::Index::Line));
	samplesStar.push_back(line13Suc);

	Type::Index::Line temp14[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line14Suc (temp14,temp14+sizeof(temp14)/sizeof(Type::Index::Line));
	samplesStar.push_back(line14Suc);

	Type::Index::Line temp15[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line15Suc (temp15,temp15+sizeof(temp15)/sizeof(Type::Index::Line));
	samplesStar.push_back(line15Suc);

	Type::Index::Line temp16[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line16Suc (temp16,temp16+sizeof(temp16)/sizeof(Type::Index::Line));
	samplesStar.push_back(line16Suc);

	Type::Index::Line temp17[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line17Suc (temp17,temp17+sizeof(temp17)/sizeof(Type::Index::Line));
	samplesStar.push_back(line17Suc);

	Type::Index::Line temp18[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line18Suc (temp18,temp18+sizeof(temp18)/sizeof(Type::Index::Line));
	samplesStar.push_back(line18Suc);

	Type::Index::Line temp19[] = {10,14,19,15,16,17,11,12,13,3,18,9,4,5,6,7,8};
	Type::List::Line line19Suc (temp19,temp19+sizeof(temp19)/sizeof(Type::Index::Line));
	samplesStar.push_back(line19Suc);
}
void PKBNextBipTest::setSamplePredecessorStarMultiCall(){
	//total line is 19

	Type::List::Line line1Pred;
	samplepStar.push_back(line1Pred);
	
	Type::Index::Line temp2[] = {1};
	Type::List::Line line2Pred (temp2,temp2+sizeof(temp2)/sizeof(Type::Index::Line));
	samplepStar.push_back(line2Pred);

	Type::Index::Line temp3[] = {1,2,9,10,11,12,13,14,15,16,17,18,19,3};
	Type::List::Line line3Pred (temp3,temp3+sizeof(temp3)/sizeof(Type::Index::Line));
	samplepStar.push_back(line3Pred);

	Type::Index::Line temp4[] = {9};
	Type::List::Line line4Pred (temp4,temp4+sizeof(temp4)/sizeof(Type::Index::Line));
	samplepStar.push_back(line4Pred);

	Type::Index::Line temp5[] = {19};
	Type::List::Line line5Pred (temp5,temp5+sizeof(temp5)/sizeof(Type::Index::Line));
	samplepStar.push_back(line5Pred);

	Type::Index::Line temp6[] = {5,18,19};
	Type::List::Line line6Pred (temp6,temp6+sizeof(temp6)/sizeof(Type::Index::Line));
	samplepStar.push_back(line6Pred);
	
	Type::Index::Line temp7[] = {6};
	Type::List::Line line7Pred (temp7,temp7+sizeof(temp7)/sizeof(Type::Index::Line));
	samplepStar.push_back(line7Pred);
	
	Type::Index::Line temp8[] = {5};
	Type::List::Line line8Pred (temp8,temp8+sizeof(temp8)/sizeof(Type::Index::Line));
	samplepStar.push_back(line8Pred);
	
	Type::Index::Line temp9[] = {2,3,8,12,18,19};
	Type::List::Line line9Pred (temp9,temp9+sizeof(temp9)/sizeof(Type::Index::Line));
	samplepStar.push_back(line9Pred);
	
	Type::Index::Line temp10[] = {9};
	Type::List::Line line10Pred (temp10,temp10+sizeof(temp10)/sizeof(Type::Index::Line));
	samplepStar.push_back(line10Pred);

	Type::Index::Line temp11[] = {18,19};
	Type::List::Line line11Pred (temp11,temp11+sizeof(temp11)/sizeof(Type::Index::Line));
	samplepStar.push_back(line11Pred);

	Type::Index::Line temp12[] = {11};
	Type::List::Line line12Pred (temp12,temp12+sizeof(temp12)/sizeof(Type::Index::Line));
	samplepStar.push_back(line12Pred);

	Type::Index::Line temp13[] = {11};
	Type::List::Line line13Pred (temp13,temp13+sizeof(temp13)/sizeof(Type::Index::Line));
	samplepStar.push_back(line13Pred);

	Type::Index::Line temp14[] = {7,10,13};
	Type::List::Line line14Pred (temp14,temp14+sizeof(temp14)/sizeof(Type::Index::Line));
	samplepStar.push_back(line14Pred);

	Type::Index::Line temp15[] = {19};
	Type::List::Line line15Pred (temp15,temp15+sizeof(temp15)/sizeof(Type::Index::Line));
	samplepStar.push_back(line15Pred);

	Type::Index::Line temp16[] = {15};
	Type::List::Line line16Pred (temp16,temp16+sizeof(temp16)/sizeof(Type::Index::Line));
	samplepStar.push_back(line16Pred);

	Type::Index::Line temp17[] = {19};
	Type::List::Line line17Pred (temp17,temp17+sizeof(temp17)/sizeof(Type::Index::Line));
	samplepStar.push_back(line17Pred);

	Type::Index::Line temp18[] = {15};
	Type::List::Line line18Pred (temp18,temp18+sizeof(temp18)/sizeof(Type::Index::Line));
	samplepStar.push_back(line18Pred);

	Type::Index::Line temp19[] = {4,14,16,17};
	Type::List::Line line19Pred (temp19,temp19+sizeof(temp19)/sizeof(Type::Index::Line));
	samplepStar.push_back(line19Pred);
}

void printList(Type::List::Line lst){
	for(int k=0;k<lst.size();k++){
			std::cout<<lst.at(k)<<" ";
	}
	std::cout<<std::endl;
}


//Public test cases
//***************************Single calls************************/
void PKBNextBipTest::testGetSuccessorNextBip(){
	insertProc();
	insertLineEntity();
	setNext();
	setCall();
	setNextBip();
	pkb = PKB::getInstance();
	setSampleSuccessor();
	// line 1
	for (int i=0; i< 12; i++){
		Type::List::Line sucsNextBip = pkb->getSuccessorNextBip(i+1);
		std::sort(sucsNextBip.begin(),sucsNextBip.end());
		int y = i+1;
		//std::cout<<"list of line "<<y<<"'s successorNextBip sample and real:"<<std::endl;
		//printList(samples.at(i));
		//printList(sucsNextBip);
		CPPUNIT_ASSERT_MESSAGE("LINE "+i+1, samples.at(i) == sucsNextBip);
	}
}
void PKBNextBipTest::testGetPredecessorNextBip(){
	insertProc();
	insertLineEntity();
	setNext();
	setCall();
	setNextBip();
	pkb = PKB::getInstance();
	setSamplePredecessor();
	for (int i=0; i< 12; i++){
		Type::List::Line predsNextBip = pkb->getPredecessorNextBip(i+1);
		std::sort(predsNextBip.begin(),predsNextBip.end());
		int y = i+1;
		//std::cout<<"list of line "<<y<<"'s predecessorNextBip sample and real:"<<std::endl;
		//printList(samplep.at(i));
		//printList(predsNextBip);
		CPPUNIT_ASSERT_MESSAGE("LINE "+i+1, samplep.at(i) == predsNextBip);
	}
}

void PKBNextBipTest::testIsNextBip(){
	insertProc();
	insertLineEntity();
	setNext();
	setCall();
	setNextBip();
	pkb = PKB::getInstance();
	CPPUNIT_ASSERT_EQUAL(true, pkb->isNextBip(2,3));
	CPPUNIT_ASSERT_EQUAL(true, pkb->isNextBip(11,2));
	CPPUNIT_ASSERT_EQUAL(true, pkb->isNextBip(10,12));
	CPPUNIT_ASSERT_EQUAL(false, pkb->isNextBip(6,2));
	CPPUNIT_ASSERT_EQUAL(false, pkb->isNextBip(9,4));
	CPPUNIT_ASSERT_EQUAL(false, pkb->isNextBip(10,11));
}
void PKBNextBipTest::testHasSuccessorNextBip(){
	insertProc();
	insertLineEntity();
	setNext();
	setCall();
	setNextBip();
	pkb = PKB::getInstance();
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasSuccessorNextBip(8));
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasSuccessorNextBip(1));
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasSuccessorNextBip(9));
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasSuccessorNextBip(1));
}
void PKBNextBipTest::testHasPredecessorNextBip(){
	insertProc();
	insertLineEntity();
	setNext();
	setCall();
	setNextBip();
	pkb = PKB::getInstance();
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasPredecessorNextBip(8));
	CPPUNIT_ASSERT_EQUAL(false, pkb->hasPredecessorNextBip(1));
}

void PKBNextBipTest::testGetSuccessorNextBipStar(){
	insertProc();
	insertLineEntity();
	setNext();
	setCall();
	setNextBip();
	setParent();
	setFollow();
	pkb = PKB::getInstance();
	setSampleSuccessorStar();
	//std::cout<<"Setting up relations down.."<<std::endl;
	// line 1
	for (int i=0; i< 12; i++){
		
		Type::List::Line sucsNextBip = pkb->getSuccessorNextBipStar(i+1);
		
		//std::cout<<"After getting the sucs.."<<std::endl;
		std::sort(sucsNextBip.begin(),sucsNextBip.end());
		std::sort(samplesStar.at(i).begin(),samplesStar.at(i).end());
		int y = i+1;
		//std::cout<<"list of line "<<y<<"'s successorNextBipStar sample and real:"<<std::endl;
		printList(samplesStar.at(i));
		printList(sucsNextBip);
		CPPUNIT_ASSERT_MESSAGE("LINE ", samplesStar.at(i) == sucsNextBip);
	}
}
void PKBNextBipTest::testGetPredecessorNextBipStar(){
	insertProc();
	insertLineEntity();
	setNext();
	setCall();
	setNextBip();
	setParent();
	setFollow();
	pkb = PKB::getInstance();
	setSamplePredecessorStar();
	//std::cout<<"Setting up relations down.."<<std::endl;
	// line 1
	for (int i=0; i< 12; i++){
		
		Type::List::Line predesNextBip = pkb->getPredecessorNextBipStar(i+1);
		
		//std::cout<<"After getting the predes.."<<std::endl;
		std::sort(predesNextBip.begin(),predesNextBip.end());
		std::sort(samplepStar.at(i).begin(),samplepStar.at(i).end());
		int y = i+1;
		//std::cout<<"list of line "<<y<<"'s predecessorNextBipStar sample and real:"<<std::endl;
		printList(samplepStar.at(i));
		printList(predesNextBip);
		CPPUNIT_ASSERT_MESSAGE("LINE ", samplepStar.at(i) == predesNextBip);
	}
}
void PKBNextBipTest::testIsNextBipStar(){
	insertProc();
	insertLineEntity();
	setNext();
	setCall();
	setNextBip();
	setParent();
	setFollow();
	pkb = PKB::getInstance();
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(2,1));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(9,1));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(2,1));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(8,12));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(8,5));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(11,8));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(10,5));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(10,8));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(2,8));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(9,8));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(6,4));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(6,7));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(8,2));
	//CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(12,2));
	for (int i = 1; i<13; i++){
		for (int j =2; j<13; j++){
			//std::cout<<"***************NOW	i j "<<i<<" "<<j<<std::endl;
			CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(i,j));
		}
	}
	
}
//***************************Multiple calls************************/
void PKBNextBipTest::testGetSuccessorNextBipMC(){
	insertProcMultiCall();
	insertLineEntityMultiCall();
	setNextMultiCall();
	setCallMultiCall();
	setNextBipMultiCall();
	pkb = PKB::getInstance();
	setSampleSuccessorMultiCall();
	// line 1
	for (int i=0; i< 19; i++){
		Type::List::Line sucsNextBip = pkb->getSuccessorNextBip(i+1);
		std::sort(sucsNextBip.begin(),sucsNextBip.end());
		int y = i+1;
		//std::cout<<"list of line "<<y<<"'s successorNextBip sample and real:"<<std::endl;
		printList(samples.at(i));
		printList(sucsNextBip);
		CPPUNIT_ASSERT_MESSAGE("LINE ", samples.at(i) == sucsNextBip);
	}
}
void PKBNextBipTest::testGetPredecessorNextBipMC(){
	insertProcMultiCall();
	insertLineEntityMultiCall();
	setNextMultiCall();
	setCallMultiCall();
	setNextBipMultiCall();
	pkb = PKB::getInstance();
	setSamplePredecessorMultiCall();
	for (int i=0; i< 19; i++){
		Type::List::Line predsNextBip = pkb->getPredecessorNextBip(i+1);
		std::sort(predsNextBip.begin(),predsNextBip.end());
		int y = i+1;
		//std::cout<<"list of line "<<y<<"'s predecessorNextBip sample and real:"<<std::endl;
		printList(samplep.at(i));
		printList(predsNextBip);
		CPPUNIT_ASSERT_MESSAGE("LINE ", samplep.at(i) == predsNextBip);
	}
}

void PKBNextBipTest::testIsNextBipMC(){
	insertProcMultiCall();
	insertLineEntityMultiCall();
	setNextMultiCall();
	setCallMultiCall();
	setNextBipMultiCall();
	pkb = PKB::getInstance();
	CPPUNIT_ASSERT_EQUAL(true, pkb->isNextBip(3,9));
	CPPUNIT_ASSERT_EQUAL(true, pkb->isNextBip(9,3));
}
void PKBNextBipTest::testHasSuccessorNextBipMC(){
	insertProcMultiCall();
	insertLineEntityMultiCall();
	setNextMultiCall();
	setCallMultiCall();
	setNextBipMultiCall();
	pkb = PKB::getInstance();
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasSuccessorNextBip(18));
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasSuccessorNextBip(19));
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasSuccessorNextBip(9));
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasSuccessorNextBip(1));
}
void PKBNextBipTest::testHasPredecessorNextBipMC(){
	insertProcMultiCall();
	insertLineEntityMultiCall();
	setNextMultiCall();
	setCallMultiCall();
	setNextBipMultiCall();
	pkb = PKB::getInstance();
	CPPUNIT_ASSERT_EQUAL(true, pkb->hasPredecessorNextBip(9));
	CPPUNIT_ASSERT_EQUAL(false, pkb->hasPredecessorNextBip(1));
}

void PKBNextBipTest::testGetSuccessorNextBipStarMC(){
	insertProcMultiCall();
	insertLineEntityMultiCall();
	setNextMultiCall();
	setCallMultiCall();
	setNextBipMultiCall();
	setParentMultiCall();
	setFollowMultiCall();
	pkb = PKB::getInstance();
	setSampleSuccessorStarMultiCall();
	//std::cout<<"Setting up relations down.."<<std::endl;
	// line 1
	for (int i=0; i< 19; i++){
		Type::List::Line sucsNextBipStar = pkb->getSuccessorNextBipStar(i+1);
		
		//std::cout<<"After getting the sucs.."<<std::endl;
		std::sort(sucsNextBipStar.begin(),sucsNextBipStar.end());
		std::sort(samplesStar.at(i).begin(),samplesStar.at(i).end());
		int y = i+1;
		//std::cout<<"list of line "<<y<<"'s successorNextBipStar sample and real:"<<std::endl;
		printList(samplesStar.at(i));
		printList(sucsNextBipStar);
		CPPUNIT_ASSERT_MESSAGE("LINE ", samplesStar.at(i) == sucsNextBipStar);
	}
}
void PKBNextBipTest::testIsNextBipStarMC(){
	insertProcMultiCall();
	insertLineEntityMultiCall();
	setNextMultiCall();
	setCallMultiCall();
	setNextBipMultiCall();
	setParentMultiCall();
	setFollowMultiCall();
	pkb = PKB::getInstance();
	setSampleSuccessorStarMultiCall();
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(6,9));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(2,1));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(9,1));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(18,1));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(19,2));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(2,2));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(3,3));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(1,1));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(4,4));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(19,2));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(5,2));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(4,2));
	CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(3,2));
	for (int i = 9; i<20; i++){
		for (int j =3; j<20; j++){
			//std::cout<<"***************NOW	i j "<<i<<" "<<j<<std::endl;
			CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(i,j));
		}
	}
	//for line 1
	for (int i = 2; i<20;i++){
		//std::cout<<"***************NOW	i j "<<"1"<<" "<<i<<std::endl;
		CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(1,i));
	}
	//for line 2
	for (int i = 3; i<20;i++){
		//std::cout<<"***************NOW	i j "<<"2"<<" "<<i<<std::endl;
		CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(2,i));
	}
	//for line 3
	for (int i = 4; i<20;i++){
		//std::cout<<"***************NOW	i j "<<"3"<<" "<<i<<std::endl;
		CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(3,i));
	}
	//for line 4
	for (int i = 5; i<20;i++){
		//std::cout<<"***************NOW	i j "<<"4"<<" "<<i<<std::endl;
		CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(4,i));
	}
	//for line 5
	for (int i =6; i<20;i++){
		//std::cout<<"***************NOW	i j "<<"5"<<" "<<i<<std::endl;
		CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(5,i));
	}
	//for line 6
	for (int i = 1; i<20;i++){
		//std::cout<<"***************NOW	i j "<<"6"<<" "<<i<<std::endl;
		if(find(samplesStar.at(5).begin(),samplesStar.at(5).end(),i)!= samplesStar.at(5).end()){
			CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(6,i));
		}else{
			CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(6,i));
		}
	}
	//for line 7
	for (int i = 1; i<20;i++){
		//std::cout<<"***************NOW	i j "<<"7"<<" "<<i<<std::endl;
		if(find(samplesStar.at(6).begin(),samplesStar.at(6).end(),i)!= samplesStar.at(6).end()){
			CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(7,i));
		}else{
			CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(7,i));
		}
	}
	//for line 8
	for (int i = 1; i<20;i++){
		//std::cout<<"***************NOW	i j "<<"8"<<" "<<i<<std::endl;
		if(find(samplesStar.at(7).begin(),samplesStar.at(7).end(),i)!= samplesStar.at(7).end()){
			CPPUNIT_ASSERT_EQUAL(true,pkb->isNextBipStar(8,i));
		}else{
			CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(8,i));
		}
	}
	for (int i = 9; i<20;i++){
		//std::cout<<"***************NOW	i j "<<i<<" "<<"2"<<std::endl;
		CPPUNIT_ASSERT_EQUAL(false,pkb->isNextBipStar(i,2));
	}
}
